package com.ruoyi.api.yh.blood;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ruoyi.api.yh.version.ApiVersion;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.yh.api.R;
import com.ruoyi.common.yh.api.dtovo.blood.BloodImageVO;
import com.ruoyi.common.yh.api.dtovo.blood.BloodInfoVO;
import com.ruoyi.yh.domain.YhBloodImage;
import com.ruoyi.yh.domain.YiBloodInfo;
import com.ruoyi.yh.service.IYhBloodImageService;
import com.ruoyi.yh.service.IYiBloodInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

@ApiSupport(order = 0)
@Api(tags="性状图片")
@RestController
@ApiVersion(1)
@RequestMapping("/{version}/app-api/bloodImage")
public class YiBloodImageApiController extends BaseController{
    @Autowired
    private Mapper dozerMapper;
    @Autowired
    private IYiBloodInfoService yiBloodInfoService;
    @Autowired
    private IYhBloodImageService yhBloodImageService;
    /**
     * 获取性状列表
     *
     */

    @ApiOperation("获取性状列表")
    @ApiOperationSupport(author = "cmm",order = 0)
    @RequestMapping(value = "/getBloodImageList",method = RequestMethod.GET)
    public R<List<BloodImageVO>> getBloodImageList(@ApiParam(name="bloodType",value = "性状类型",required = true)@RequestParam String bloodType,@ApiParam(name="searchInput",value = "搜索",required = true)@RequestParam String searchInput)
    {
        YhBloodImage yhBloodImageuery=new YhBloodImage();
        yhBloodImageuery.setBloodType(bloodType);
        yhBloodImageuery.setImageName(searchInput);
        List<YhBloodImage> list = yhBloodImageService.selectYhBloodImageList(yhBloodImageuery);
        List<BloodImageVO>  bloodImageVOs=new ArrayList<>();
        for(YhBloodImage yhBloodImage:list){
            BloodImageVO bloodImageVO=dozerMapper.map(yhBloodImage, BloodImageVO.class);
            bloodImageVOs.add(bloodImageVO);
            }
        return R.ok(bloodImageVOs,"获取性状列表");
    }
}
